home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2007 December / PCWKCD1207B.iso / Windows marzen / Maxthon 2.0.4 / mx_2.0.4.5799.exe / template / History / maxHistory.js < prev   
Text File  |  2007-09-20  |  19KB  |  552 lines

  1. var maxHistory={};
  2. maxHistory.currentPage="history";
  3. $langDefaultSection="History";
  4. maxHistory.init=function(){
  5. maxConfig.setActiveFile("$dynamic");
  6. document.title=$lang("title");
  7. var _1=$id("searchBar");
  8. _1.value=$lang("type_keyword");
  9. _1=$id("btnReset");
  10. _1.style.display="none";
  11. maxHistory.activatePage("history");
  12. };
  13. maxHistory.activatePage=function(_2){
  14. var _3=$id("page_"+maxHistory.currentPage);
  15. if(_3){
  16. _3.className="";
  17. }
  18. var _3=$id("page_"+_2);
  19. if(_3){
  20. _3.className="buttons-active";
  21. }
  22. maxHistory.currentPage=_2;
  23. maxHistory.search.reset();
  24. maxHistory[_2].init();
  25. };
  26. maxHistory.toggleDeleteButton=function(_4,id){
  27. var _6=$id(id+"_delete");
  28. var _7=$id(id+"_icon");
  29. if(!_6||!_7){
  30. alert(_7);
  31. return;
  32. }
  33. if(_4){
  34. _6.style.display="inline";
  35. _7.style.display="none";
  36. }else{
  37. _6.style.display="none";
  38. _7.style.display="inline";
  39. }
  40. };
  41. maxHistory.clean=function(){
  42. if(!confirm($lang("confirm_clean"))){
  43. return;
  44. }
  45. if(maxHistory.currentPage=="feed"){
  46. maxHistory.feed.clean();
  47. }else{
  48. if(maxHistory.currentPage=="keyword"){
  49. maxHistory.keyword.clean();
  50. }else{
  51. maxHistory.history.clean();
  52. }
  53. }
  54. };
  55. maxHistory.search={};
  56. maxHistory.search.select=function(){
  57. var _8=$id("searchBar");
  58. if(_8.value==$lang("type_keyword")){
  59. _8.select();
  60. }
  61. };
  62. maxHistory.search.reset=function(_9){
  63. var _a=$id("searchBar");
  64. _a.value=$lang("type_keyword");
  65. _a=$id("btnReset");
  66. _a.style.display="none";
  67. if(_9){
  68. maxHistory.search.execute();
  69. }
  70. };
  71. maxHistory.search.typeAndGo=function(){
  72. var _b=$id("searchBar");
  73. var _c=$id("btnReset");
  74. if(_b.value.$trim()!=""){
  75. _c.style.display="inline";
  76. }else{
  77. _c.style.display="none";
  78. }
  79. maxHistory.search.lastCall=new Date();
  80. maxHistory.search.typeAndGoCheck();
  81. };
  82. maxHistory.search.typeAndGoCheck=function(){
  83. if(!maxHistory.search.lastCall){
  84. return;
  85. }
  86. var _d=Number(new Date())-Number(maxHistory.search.lastCall);
  87. if(_d>500){
  88. maxHistory.search.lastCall=null;
  89. maxHistory.search.execute();
  90. }else{
  91. setTimeout(maxHistory.search.typeAndGoCheck,500);
  92. }
  93. };
  94. maxHistory.search.execute=function(){
  95. var _e=$id("searchBar");
  96. var _f=_e.value.$trim();
  97. if(_f==$lang("type_keyword")){
  98. _f="";
  99. }
  100. if(maxHistory.currentPage=="feed"){
  101. maxHistory.feed.searchKeywordChange(_f);
  102. }else{
  103. if(maxHistory.currentPage=="keyword"){
  104. maxHistory.keyword.keywordChange(_f);
  105. }else{
  106. maxHistory.history.keywordChange(_f);
  107. }
  108. }
  109. };
  110. maxHistory.history={};
  111. maxHistory.history.api=null;
  112. maxHistory.history.searchKeyword="";
  113. maxHistory.history.currentMode="list";
  114. maxHistory.history.init=function(){
  115. maxHistory.history.initAPI();
  116. maxHistory.history.searchKeyword="";
  117. maxHistory.history.list.init();
  118. };
  119. maxHistory.history.initAPI=function(){
  120. var obj;
  121. try{
  122. obj=external.max_getObj(max_security_id,"history");
  123. }
  124. catch(e){
  125. alert("create history object failed");
  126. throw (e);
  127. return;
  128. }
  129. maxHistory.history.api=obj;
  130. if(maxHistory.history.api.reload()<0){
  131. alert("maxHistory.history.initAPI : load data error");
  132. return;
  133. }
  134. maxHistory.history.api.sortMethod="%lastvisit-desc";
  135. };
  136. maxHistory.history.deleteItem=function(id){
  137. maxHistory.history.api.deleteItem(id);
  138. };
  139. maxHistory.history.clean=function(){
  140. maxHistory.history.api.clearAll();
  141. maxHistory.history.init();
  142. };
  143. maxHistory.history.keywordChange=function(_12){
  144. if(maxHistory.history.searchKeyword==_12){
  145. return;
  146. }
  147. maxHistory.history.searchKeyword=_12;
  148. if(_12==""){
  149. if(maxHistory.history.currentMode!="list"){
  150. maxHistory.history.list.init();
  151. }
  152. maxHistory.history.currentMode="list";
  153. }else{
  154. maxHistory.history.search.init(_12);
  155. maxHistory.history.currentMode="search";
  156. }
  157. };
  158. maxHistory.history.list={};
  159. maxHistory.history.list.dateSpan=null;
  160. maxHistory.history.list.init=function(){
  161. maxHistory.history.list.buildHTML();
  162. maxHistory.history.list.adjustHeight();
  163. window.onresize=maxHistory.history.list.adjustHeight;
  164. maxHistory.history.list.buildDateList();
  165. var str=(new Date()).$toString("yyyy MM dd");
  166. maxHistory.history.list.setDateSpan(str,str);
  167. maxHistory.history.list.activateButton("date","dateToday");
  168. };
  169. maxHistory.history.list.buildHTML=function(_14){
  170. var _15="";
  171. _15+="<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" class=\"list-table\" id=\"listTable\">"+"<tr>"+"<td width=\"15%\" valign=\"top\" class=\"list-panel\" nowrap=\"nowrap\"><div id=\"dateList\" style=\"width:100%; heihgt: 500px; overflow-y:auto; overflow-x:hidden;\"> </div></td>"+"<td width=\"25%\" valign=\"top\" class=\"list-panel\" nowrap=\"nowrap\"><div id=\"siteList\" style=\"width:100%; heihgt: 500px; overflow-y:auto; overflow-x:hidden;\"> </div></td>"+"<td valign=\"top\"><div id=\"itemList\" style=\"width:100%; height: 500px; overflow-y:auto; overflow-x:hidden;\"> </div></td>"+"</tr>"+"</table>";
  172. $id("contentWrapper").innerHTML=_15;
  173. };
  174. maxHistory.history.list.adjustHeight=function(){
  175. if(!$id("listTable")){
  176. return;
  177. }
  178. var _16=document.documentElement.clientHeight-160;
  179. $id("dateList").style.height=_16-10;
  180. $id("siteList").style.height=_16-10;
  181. $id("itemList").style.height=_16-10;
  182. };
  183. maxHistory.history.list.buildDateList=function(_17){
  184. var _18=[];
  185. var _19=$Date.parse(maxHistory.history.api.oldestDate);
  186. var _1a=new Date();
  187. var _1b=_19.getFullYear();
  188. var _1c=_1a.getFullYear();
  189. var _1d=_19.getMonth()+1;
  190. var _1e=_1a.getMonth()+1;
  191. var _1f=_19.getDate();
  192. var _20=_1a.getDate();
  193. var _21=_19.getDay();
  194. var _22=_1a.getDay();
  195. if(_21==0){
  196. _21=7;
  197. }
  198. if(_22==0){
  199. _22=7;
  200. }
  201. var _23=Math.floor(Number(_19)/86400000);
  202. var _24=Math.floor(Number(_1a)/86400000);
  203. _18.push(["","","dateAll",$lang("all_date")]);
  204. _18.push([_1a.$toString("yyyy MM dd"),_1a.$toString("yyyy MM dd"),"dateToday",$lang("today")]);
  205. if(_22>1&&_23!=_24){
  206. var _25=_24-_23;
  207. if(_25>6){
  208. _25=0;
  209. }else{
  210. _25=_22-_25-1;
  211. }
  212. for(var i=_22-1;i>0;i--){
  213. var _27=new Date();
  214. _27.setDate(_20-_22+i);
  215. var str=_27.$toString("yyyy MM dd");
  216. _18.push([str,str,"dateWeekDay_"+i,$lang("weekday_"+i)]);
  217. }
  218. }
  219. if((_24-_22+1)>_23){
  220. var cnt=Math.ceil((_24-_22+1-_23)/7);
  221. if(cnt>4){
  222. cnt=4;
  223. }
  224. var _2a=new Date();
  225. var _2b=new Date();
  226. _2a.setDate(_2b.getDate()-_22-6);
  227. _2b.setDate(_2b.getDate()-_22);
  228. for(var i=1;i<cnt;i++){
  229. _18.push([_2a.$toString("yyyy MM dd"),_2b.$toString("yyyy MM dd"),"dateWeek_"+i,$lang(i+"_week_ago")]);
  230. _2a.setDate(_2a.getDate()-7);
  231. _2b.setDate(_2b.getDate()-7);
  232. }
  233. }
  234. if(_1b!=_1c||_1d!=_1e){
  235. var cnt=(_1c-_1b)*12+_1e-_1d;
  236. var _2c=_1c;
  237. var _2d=_1e;
  238. var _2e=[0,31,28,31,30,31,30,31,31,30,31,30,31];
  239. for(var i=0;i<cnt;i++){
  240. _2d--;
  241. if(_2d==0){
  242. _2c--;
  243. _2d=12;
  244. }
  245. _18.push([_2c+" "+_2d+" 1",_2c+" "+_2d+" "+_2e[_2d],"dateMonth_"+i,_2c+"-"+_2d]);
  246. }
  247. }
  248. var _2f="";
  249. for(var i=0;i<_18.length;i++){
  250. var _17=_18[i];
  251. _2f+="<div class=\"list-sep-item\">"+(i==0?"<strong>":"")+"<a href=\"javascript:maxHistory.history.list.setDateSpan('"+_17[0]+"','"+_17[1]+"')\""+" onclick=\"maxHistory.history.list.activateButton('date','"+_17[2]+"');this.blur()\" id=\""+_17[2]+"\""+" onmouseover=\"maxHistory.toggleDeleteButton(true,'date_"+i+"');\""+" onmouseout=\"maxHistory.toggleDeleteButton(false,'date_"+i+"');\""+">"+"<img src=\"images/calendar.png\" id=\"date_"+i+"_icon\" />"+"<img src=\"images/delete.png\" style=\"display:none\" id=\"date_"+i+"_delete\" alt=\""+$lang("delete")+"\" onclick=\"maxHistory.history.list.deleteByDate('"+_17[3]+"','"+_17[0]+"','"+_17[1]+"')\"/> "+_17[3]+"</a>"+(i==0?"</strong>":"")+"</div>";
  252. }
  253. $id("dateList").innerHTML=_2f;
  254. };
  255. maxHistory.history.list.getDateCount=function(_30,_31){
  256. maxHistory.history.api.fromDate=_30;
  257. maxHistory.history.api.toDate=_31;
  258. var str=maxHistory.history.api.output("%id");
  259. return maxHistory.history.api.itemCount;
  260. };
  261. maxHistory.history.list.setDateSpan=function(_33,_34){
  262. maxHistory.history.api.fromDate=_33;
  263. maxHistory.history.api.toDate=_34;
  264. maxHistory.history.list.buildSiteList();
  265. };
  266. maxHistory.history.list.deleteByDate=function(_35,_36,_37){
  267. window.event.cancelBubble=true;
  268. window.event.returnValue=false;
  269. if(!confirm($lang("confirm_delete_date")+"\n\n\""+_35+"\"")){
  270. return;
  271. }
  272. maxHistory.history.api.fromDate=_36;
  273. maxHistory.history.api.toDate=_37;
  274. maxHistory.history.api.outputFormat="%id,";
  275. var _38=maxHistory.history.api.output();
  276. maxHistory.history.deleteItem(_38);
  277. maxHistory.history.initAPI();
  278. maxHistory.history.list.init();
  279. };
  280. maxHistory.history.list.buildSiteList=function(){
  281. var _39="";
  282. var _3a=maxHistory.history.api.getDomainList("%domain$,$%title$||$");
  283. _3a=_3a.split("$||$");
  284. for(var i=0;i<_3a.length;i++){
  285. var tmp=_3a[i].split("$,$");
  286. if(tmp.length!=2){
  287. continue;
  288. }
  289. _39+="<a href=\"javascript:maxHistory.history.list.setSite('"+tmp[0].$safeQuote(true).$encodeHTML()+"')\""+" onclick=\"maxHistory.history.list.activateButton('site','site_"+i+"');this.blur()\" id=\"site_"+i+"\""+" onmouseover=\"maxHistory.toggleDeleteButton(true,'site_"+i+"');\""+" onmouseout=\"maxHistory.toggleDeleteButton(false,'site_"+i+"');\""+" title=\""+tmp[0].$encodeHTML()+"\" />"+"<img src=\"images/website.png\" id=\"site_"+i+"_icon\" />"+"<img src=\"images/delete.png\" style=\"display:none\" id=\"site_"+i+"_delete\" alt=\""+$lang("delete")+"\" onclick=\"maxHistory.history.list.deleteBySite('"+tmp[0].$safeQuote(true).$encodeHTML()+"')\"/> "+tmp[1].$cut(40).$encodeHTML()+"</a>";
  290. }
  291. if(_39==""){
  292. _39=" ";
  293. }
  294. $id("siteList").innerHTML=_39;
  295. $id("itemList").innerHTML=" ";
  296. };
  297. maxHistory.history.list.setSite=function(_3d){
  298. maxHistory.history.api.targetDomain=_3d;
  299. maxHistory.history.list.buildItemList();
  300. };
  301. maxHistory.history.list.deleteBySite=function(_3e){
  302. window.event.cancelBubble=true;
  303. window.event.returnValue=false;
  304. if(!confirm($lang("confirm_delete_site")+"\n\n"+_3e)){
  305. return;
  306. }
  307. maxHistory.history.api.targetDomain=_3e;
  308. maxHistory.history.api.outputFormat="%id,";
  309. var _3f=maxHistory.history.api.output();
  310. maxHistory.history.deleteItem(_3f);
  311. maxHistory.history.list.buildSiteList();
  312. };
  313. maxHistory.history.list.buildItemList=function(){
  314. maxHistory.history.api.pageSize=0;
  315. maxHistory.history.api.outputFormat="%id$,$%title$,$%url$,$%yy-%mm-%dd$,$%icon$,$%summary$||$";
  316. maxHistory.history.api.searchKeyword="";
  317. maxHistory.history.api.currentPage=1;
  318. var _40="";
  319. var _41=maxHistory.history.api.output();
  320. _41=_41.split("$||$");
  321. for(var i=0;i<_41.length;i++){
  322. var tmp=_41[i].split("$,$");
  323. if(tmp.length!=6){
  324. continue;
  325. }
  326. var _44={};
  327. _44.id=tmp[0];
  328. _44.title=tmp[1];
  329. _44.url=tmp[2];
  330. _44.lastVisit=tmp[3];
  331. _44.icon=tmp[4];
  332. _44.summary=tmp[5];
  333. if(_44.url==""){
  334. continue;
  335. }
  336. if(_44.title==""){
  337. _44.title=_44.url;
  338. }
  339. if(_44.icon==""){
  340. _44.icon="images/page.png";
  341. }else{
  342. _44.icon="file:///"+_44.icon;
  343. }
  344. _40+="<div class=\"list-item\">";
  345. _40+="<span onmouseover=\"maxHistory.toggleDeleteButton(true,'item_"+i+"');\" onmouseout=\"maxHistory.toggleDeleteButton(false,'item_"+i+"');\">"+"<img src=\""+_44.icon+"\" id=\"item_"+i+"_icon\" width=\"16\" height=\"16\"/>"+"<img id=\"item_"+i+"_delete\" src=\"images/delete.png\" alt=\""+$lang("delete")+"\" style=\"cursor: pointer;display:none;\" onclick=\"maxHistory.history.list.deleteItem('"+_44.id+"')\" />"+" <a href=\""+_44.url.$sanitizeURL()+"\" target=\"_blank\" title=\""+_44.title.$encodeHTML()+" ("+_44.url.$safeQuote(true).$encodeHTML()+")\">"+_44.title.$cut(60).$encodeHTML()+"</a>"+"</span>"+" <span class=\"list-item-label\">["+_44.lastVisit+"]</span>";
  346. _40+="</div>";
  347. }
  348. if(_40==""){
  349. maxHistory.history.list.buildSiteList();
  350. _40=" ";
  351. }
  352. $write(_40,"itemList");
  353. };
  354. maxHistory.history.list.deleteItem=function(id){
  355. if(id){
  356. maxHistory.history.deleteItem(id);
  357. maxHistory.history.list.buildItemList();
  358. }
  359. };
  360. maxHistory.history.list.activateButton=function(_46,id){
  361. if(maxHistory.history.list["active"+_46]){
  362. var obj=$id(maxHistory.history.list["active"+_46]);
  363. if(obj){
  364. obj.className="";
  365. }
  366. }
  367. var obj=$id(id);
  368. obj.className="active";
  369. maxHistory.history.list["active"+_46]=id;
  370. };
  371. maxHistory.history.search={};
  372. maxHistory.history.search.init=function(_49){
  373. maxHistory.history.api.searchKeyword=_49;
  374. maxHistory.history.api.currentPage=1;
  375. maxHistory.history.search.execute();
  376. };
  377. maxHistory.history.search.execute=function(){
  378. maxHistory.history.api.fromDate="";
  379. maxHistory.history.api.toDate="";
  380. maxHistory.history.api.targetDomain="";
  381. maxHistory.history.api.pageSize=20;
  382. maxHistory.history.api.outputFormat="%id$,$%title$,$%url$,$%yy-%mm-%dd$,$%icon$,$%summary$||$";
  383. var _4a="";
  384. var _4b=maxHistory.history.api.output();
  385. _4b=_4b.split("$||$");
  386. for(var i=0;i<_4b.length;i++){
  387. var tmp=_4b[i].split("$,$");
  388. if(tmp.length!=6){
  389. continue;
  390. }
  391. var _4e={};
  392. _4e.id=tmp[0];
  393. _4e.title=tmp[1];
  394. _4e.url=tmp[2];
  395. _4e.lastVisit=tmp[3];
  396. _4e.icon=tmp[4];
  397. _4e.summary=tmp[5];
  398. if(_4e.url==""){
  399. continue;
  400. }
  401. if(_4e.title==""){
  402. _4e.title=_4e.url;
  403. }
  404. if(_4e.icon==""){
  405. _4e.icon="images/page.png";
  406. }else{
  407. _4e.icon="file:///"+_4e.icon;
  408. }
  409. _4a+="<div class=\"search-item\">";
  410. _4a+="<span onmouseover=\"maxHistory.toggleDeleteButton(true,'item_"+i+"');\" onmouseout=\"maxHistory.toggleDeleteButton(false,'item_"+i+"');\">"+"<img src=\""+_4e.icon+"\" id=\"item_"+i+"_icon\" width=\"16\" height=\"16\"/>"+"<img id=\"item_"+i+"_delete\" src=\"images/delete.png\" alt=\""+$lang("delete")+"\" style=\"cursor: pointer;display:none;\" onclick=\"maxHistory.history.search.deleteItem('"+_4e.id+"')\" />"+" <a href=\""+_4e.url.$sanitizeURL()+"\" target=\"_blank\" title=\""+_4e.title.$encodeHTML()+"\">"+_4e.title.$cut(60).$encodeHTML()+"</a>"+"</span>"+" <span class=\"search-item-label\">["+_4e.lastVisit+"]</span>"+"<div class=\"search-item-url\">"+_4e.url.$encodeHTML()+"</div>"+"</div>";
  411. _4a+="</div>";
  412. }
  413. var _4f="";
  414. if(maxHistory.history.api.itemCount>maxHistory.history.api.pageSize){
  415. var _50={"separator":" ","normal":"<a href=\"javascript:maxHistory.history.search.gotoPage(%page);\"> %page </a>","active":"<a href=\"javascript:;\" class=\"buttons-active\"> %page </a>","prev":"<a href=\"javascript:maxHistory.history.search.gotoPage(%page);\" style=\"font-size: 150%\"> ‹ </a>","next":"<a href=\"javascript:maxHistory.history.search.gotoPage(%page);\" style=\"font-size: 150%\"> › </a>","first":"<a href=\"javascript:maxHistory.history.search.gotoPage(%page);\" style=\"font-size: 150%\"> « </a>","last":"<a href=\"javascript:maxHistory.history.search.gotoPage(%page);\" style=\"font-size: 150%\"> » </a>"};
  416. _4f=$pageLinks(maxHistory.history.api.itemCount,maxHistory.history.api.pageSize,maxHistory.history.api.currentPage,5,_50);
  417. }
  418. var _51="<div class=\"buttonWrapper\">"+"<div class=\"buttons\">"+_4f+"<div class=\"label\">"+$lang("result_count").replace(/\%int/ig,maxHistory.history.api.itemCount)+"</div>"+"</div>"+"</div>"+"<br/>";
  419. _4a=_51+_4a+_51;
  420. var obj=$id("contentWrapper");
  421. obj.innerHTML=_4a;
  422. };
  423. maxHistory.history.search.deleteItem=function(id){
  424. if(id){
  425. maxHistory.history.deleteItem(id);
  426. maxHistory.history.search.execute();
  427. }
  428. };
  429. maxHistory.history.search.gotoPage=function(_54){
  430. if(_54<1||_54>maxHistory.history.api.pageCount){
  431. return;
  432. }
  433. maxHistory.history.api.currentPage=_54;
  434. maxHistory.history.search.execute();
  435. };
  436. maxHistory.feed={};
  437. maxHistory.feed.searchKeyword="";
  438. maxHistory.feed.init=function(){
  439. maxHistory.feed.data=maxConfig.ini.getArray("RSSHistory",false);
  440. $id("contentWrapper").innerHTML="<div id=\"listWrapper\" style=\"width:100%; heihgt: 500px; overflow-y:auto; overflow-x:hidden;\"> </div>";
  441. maxHistory.feed.searchKeyword="";
  442. maxHistory.feed.buildList();
  443. maxHistory.feed.adjustHeight();
  444. window.onresize=maxHistory.feed.adjustHeight;
  445. };
  446. maxHistory.feed.adjustHeight=function(){
  447. if(!$id("listWrapper")){
  448. return;
  449. }
  450. var _55=document.documentElement.clientHeight-160;
  451. $id("listWrapper").style.height=_55-10;
  452. };
  453. maxHistory.feed.buildList=function(){
  454. var _56=false;
  455. if(maxHistory.feed.searchKeyword!=""){
  456. _56=true;
  457. }
  458. var _57="";
  459. for(var i=maxHistory.feed.data.length-1;i>-1;i--){
  460. var _59=maxHistory.feed.data[i][0];
  461. var url=maxHistory.feed.data[i][1];
  462. if(_59==""){
  463. _59=url;
  464. }
  465. if(!_56||(_56&&(_59.indexOf(maxHistory.feed.searchKeyword)>-1||url.indexOf(maxHistory.feed.searchKeyword)>-1))){
  466. var _5b=url.$sanitizeURL();
  467. _57+=_56?"<div class=\"search-item\">":"<div class=\"list-item\">";
  468. _57+="<span onmouseover=\"maxHistory.toggleDeleteButton(true,'item_"+i+"');\" onmouseout=\"maxHistory.toggleDeleteButton(false,'item_"+i+"');\">"+"<img src=\"images/feed.png\" id=\"item_"+i+"_icon\" width=\"16\" height=\"16\"/>"+"<img id=\"item_"+i+"_delete\" src=\"images/delete.png\" alt=\""+$lang("delete")+"\" style=\"cursor: pointer;display:none;\" onclick=\"maxHistory.feed.deleteItem("+i+")\" />"+" <a href=\""+_5b+"\" target=\"_blank\">"+_59.$cut(100).$encodeHTML()+"</a>"+"</span>"+" <a href=\"javascript:;\" onclick=\"maxHistory.feed.add('"+_5b+"');\"><img src=\"images/add.png\" alt=\"\" /></a>"+(_56?"<div class=\"search-item-url\">"+_5b.$encodeHTML()+"</div>":"");
  469. _57+="</div>";
  470. }
  471. }
  472. $id("listWrapper").innerHTML=_57+"<br/><br/>";
  473. };
  474. maxHistory.feed.searchKeywordChange=function(_5c){
  475. maxHistory.feed.searchKeyword=_5c;
  476. maxHistory.feed.buildList();
  477. };
  478. maxHistory.feed.add=function(url){
  479. external.max_addRSS(url);
  480. };
  481. maxHistory.feed.deleteItem=function(_5e){
  482. var _5f=maxHistory.feed.data[_5e];
  483. if(_5f){
  484. maxConfig.ini.deleteKey("RSSHistory",_5f[0]);
  485. maxConfig.save();
  486. maxHistory.feed.data.splice(_5e,1);
  487. maxHistory.feed.buildList();
  488. }
  489. };
  490. maxHistory.feed.clean=function(){
  491. maxConfig.ini.deleteSection("RSSHistory");
  492. maxConfig.save();
  493. maxHistory.feed.init();
  494. };
  495. maxHistory.keyword={};
  496. maxHistory.keyword.searchKeyword="";
  497. maxHistory.keyword.init=function(){
  498. maxHistory.keyword.data=maxConfig.ini.getArray("SearchHistory",false,"dynamic");
  499. $id("contentWrapper").innerHTML="<div id=\"listWrapper\" style=\"width:100%; heihgt: 500px; overflow-y:auto; overflow-x:hidden;\"> </div>";
  500. maxHistory.keyword.searchKeyword="";
  501. maxHistory.keyword.buildList();
  502. maxHistory.keyword.adjustHeight();
  503. window.onresize=maxHistory.keyword.adjustHeight;
  504. };
  505. maxHistory.keyword.adjustHeight=function(){
  506. if(!$id("listWrapper")){
  507. return;
  508. }
  509. var _60=document.documentElement.clientHeight-160;
  510. $id("listWrapper").style.height=_60-10;
  511. };
  512. maxHistory.keyword.keywordChange=function(_61){
  513. maxHistory.keyword.searchKeyword=_61;
  514. maxHistory.keyword.buildList();
  515. };
  516. maxHistory.keyword.buildList=function(){
  517. var _62=false;
  518. if(maxHistory.keyword.searchKeyword!=""){
  519. _62=true;
  520. }
  521. var _63="";
  522. for(var i=maxHistory.keyword.data.length-1;i>-1;i--){
  523. var _65=maxHistory.keyword.data[i][0];
  524. if(!_62||(_62&&_65.indexOf(maxHistory.keyword.searchKeyword)>-1)){
  525. _63+="<div class=\"list-item\">";
  526. _63+="<span onmouseover=\"maxHistory.toggleDeleteButton(true,'item_"+i+"');\" onmouseout=\"maxHistory.toggleDeleteButton(false,'item_"+i+"');\">"+"<img src=\"images/keyword.png\" id=\"item_"+i+"_icon\" width=\"16\" height=\"16\"/>"+"<img id=\"item_"+i+"_delete\" src=\"images/delete.png\" alt=\""+$lang("delete")+"\" style=\"cursor: pointer;display:none;\" onclick=\"maxHistory.keyword.deleteItem("+i+")\" />"+" <a href=\"javascript:;\" onclick=\"maxHistory.keyword.open('"+_65.$safeQuote()+"')\">"+_65.$cut(100).$encodeHTML()+"</a>"+"</span>";
  527. _63+="</div>";
  528. }
  529. }
  530. $id("listWrapper").innerHTML=_63+"<br/><br/>";
  531. };
  532. maxHistory.keyword.open=function(_66){
  533. external.max_newTab(max_security_id,"? "+_66);
  534. };
  535. maxHistory.keyword.deleteItem=function(_67){
  536. var _68=maxHistory.keyword.data[_67];
  537. if(_68){
  538. maxConfig.ini.deleteKey("SearchHistory",_68[0]);
  539. maxConfig.save();
  540. external.max_reload("searchhistory");
  541. maxHistory.keyword.data.splice(_67,1);
  542. maxHistory.keyword.buildList();
  543. }
  544. };
  545. maxHistory.keyword.clean=function(){
  546. maxConfig.ini.deleteSection("SearchHistory");
  547. maxConfig.save();
  548. external.max_reload("searchhistory");
  549. maxHistory.keyword.init();
  550. };
  551.  
  552.